<style>
    .layui-form .layui-form-item .layui-inline .layui-form-label {
        width: 350px;
        font-size: 18px;
        font-weight: bold;
    }
    .layui-form .layui-form-item .layui-inline .layui-input-inline{
        font-size: 18px;
        width: 150px;
    }
    .layui-form .layui-form-item .layui-inline{
        line-height: 30px;
    }
</style>
<form class="layui-form  seller-form" style="padding:20px;height: auto;min-height:700px;width: auto;min-width: 1200px;">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>
            <a href="{:url('funding')}" style="color: #428bca;font-weight:bold;" >Funding Activity</a> / Fund Edit
        </legend>
    </fieldset>
    <br/>
    <input type="hidden" name='fc_id' value="{$fc_id}">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">充值渠道 ：</label>
            <div class="layui-input-inline">{$pay_type ?? ''}</div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">转账日期：</label>
            <div class="layui-input-inline">{$data.date ?? ''}</div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">充值金额($)：</label>
            <div class="layui-input-inline" style="font-weight:bold;">
                <input type="text" name="amount" style="color:#FF5722;" value="{$data.amount ?? ''}" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">付款人账号：</label>
            <div class="layui-input-inline">{$data.name ?? ''}</div>
        </div>
    </div>

    <div class="layui-form-item" style="line-height: 50px;">
        <div class="layui-inline" >
            <label class="layui-form-label">UserMemo：</label>
            <div class="layui-input-inline" style="width: auto">
                <font color="green" style="font-weight: bold">{$user_num}</font>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">Check Img ：</label>
            <div class="layui-input-inline" id="photo-list">
                <img src="{$data.upload_img}" style="width: 150px;height: 200px;cursor:pointer">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline" >
            <label class="layui-form-label">Failed Remark：</label>
            <div class="layui-input-inline" style="width: auto">
                    <textarea name="remark" id="remark" style="width: 200px;padding-left: 2px;"
                              placeholder="Input Failed" class="layui-textarea">{$remark ?? ''}</textarea>
            </div>
        </div>
        <div class="layui-inline" >
            <label class="layui-form-label">Manage Remark：</label>
            <div class="layui-input-inline" style="width: auto">
                    <textarea name="manage_remark" id="manage_remark" style="width: 300px;padding-left: 2px;"
                              placeholder="Input Failed" class="layui-textarea">{$manage_remark ?? ''}</textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="line-height: 50px;">
        <div class="layui-inline" >
            <label class="layui-form-label">Check Status：</label>
            <div class="layui-input-inline" style="width: auto">
                {if $check_status eq 0}
                <input type="radio" name="check_status" value="1" title="Completed">
                <input type="radio" name="check_status" value="2" title="Failed">
                {else}
                    {if $check_status eq 1}
                        <font color="green" style="font-weight: bold">Completed</font>
                    {else}
                        <font color="red" style="font-weight: bold">Failed</font>
                    {/if}
                {/if}
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="padding-top: 30px;">
        <div class="layui-input-block">
            {if $check_status eq 0}
                <button type="button" class="layui-btn" lay-submit lay-filter="sub">Ok</button>
            {/if}
            <a href="{:url('funding')}" class="layui-btn layui-btn-primary">{:lang('Cancel')}</a>
        </div>
    </div>
</form>
<script>
    layui.use(['form'], function () {
        var form = layui.form;
        form.on('submit(sub)', function(data){
            const check_status  = data.field.check_status;
            const remark        = data.field.remark;
            if(check_status == 2){
                if(remark == ''){
                    layer.msg('Please fill in Failed Remark.' , {time: 1500 , icon:2});
                    return false;
                }
            }
            var loading =layer.load(1, {shade: [0.1,'#fff']});
            JsPost("{:url('balance/fundsEdit')}", data.field, function(res){
                layer.close(loading);
                if(res.code >0){
                    layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                        window.location.href = "{:url('funding')}";
                    });
                }else{
                    layer.msg(res.msg , {time: 1500 , icon:2});
                }
            })
        });
        $('#photo-list img').on('click', function () {
            layer.photos({
                photos: '#photo-list',
                shadeClose: false,
                closeBtn: 2,
                anim: 5
            });
        })
    });
</script>
